package com.young.springdemo.service.observerPattern;


//抽象接口类,充当目标类()

import java.util.ArrayList;
import java.util.List;

public abstract class AllyControllerCenter {

    protected String name;
    protected List<Observer> players = new ArrayList<>();


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    //加入站队
    public void  join(Observer observer){
        players.add(observer);
        System.out.println(observer.getName()+"加入了"+ this.name+"站队");
    }

    public void  quit(Observer observer){
        players.remove(observer);
        System.out.println(observer.getName()+"退出了"+this.name+"站队");
    }

    public abstract void notify(String name);

}
